package ex3;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;

public class Main {
	
	public static void main(String[] args) {
		
		try{
		URL url = new URL("http://cnds.students.dk/example3.php");
		URLConnection conn = url.openConnection();
		conn.setDoOutput(true);
		OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
		wr.write("year=2009&month=august");
		wr.flush();
		wr.close();
		InputStreamReader r = new InputStreamReader(conn.getInputStream());
		BufferedReader in = new BufferedReader(r);
		String str;
		while ((str = in.readLine()) != null) {
		System.out.println(str);
		}
		in.close();
		}
		catch (IOException e) {
			// TODO: handle exception
			e.getMessage();
		}
		catch (Exception e) {
			// TODO: handle exception
		}{
			
		}
	}

}
